package pefl.logic;

import java.util.ArrayList;
import java.util.List;

import pefl.beans.Team;
/**
 * 
 * @author Homerr
 *
 */
public class BusinessLogic {
	private static List<Team> teams = new ArrayList<Team>();
	/**
	 * 
	 */
	public static void initiateTeams(){
		addTeam("Малага","http://pefl.ru/plug.php?p=refl&t=k&j=810&z=0a981fec6985c2273b206fe62f192aee","BallaK",23488);
		addTeam("Барселона","http://pefl.ru/plug.php?p=refl&t=k&j=795&z=681f94e463bd2ae01791e493c5a4bfc7","RuslanM",68987);
		addTeam("Хетафе","http://pefl.ru/plug.php?p=refl&t=k&j=806&z=208d2036658324079a53c158e73cdf15","Roland",5674);
			
		
	}
	/**
	 * 
	 */
	public static void printTeams(){
		for (Team team:teams){
			System.out.println(team.getTeamName());
		}
	}
	
	private static void addTeam(String teamName,String link,String manager,long rating){
		Team team = new Team(teamName,link,manager,rating);
		int index = 0;
		while (index<teams.size()&&rating<teams.get(index).getRating()){
			index++;
		}
		teams.add(index, team);
	}
	
}
